<%-- 
    Document   : logout
    Created on : Apr 30, 2010, 1:41:02 AM
    Author     : Shiag
--%>
<%@page import="powerpass.PowerPassSQL" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <%
                    PowerPassSQL pp = new PowerPassSQL();
                    String browser = (String)request.getHeader("User-Agent");
                    java.text.DateFormat dateFormat = new java.text.SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
                    java.util.Date date = new java.util.Date();
                        String newSQL = "INSERT INTO loginhistory(clientid,logtype,logindt,browser)" +
                            "VALUES("+session.getAttribute("theClient")+",'LogOut','"+ dateFormat.format(date)+"','"+browser+"');";
                        pp.insertInfo(newSQL);
                        session.setAttribute("theName", null);
                        session.setAttribute("thePass", null);
                        session.setAttribute("theClient", null);
                        session.setAttribute("theAnswer1", null);
                        session.setAttribute("theAnswer2",null);
                        session.setAttribute("theMessage","");
                        String redirectURL = "login.jsp";
                        response.sendRedirect(redirectURL);
        %>
    </body>
</html>
